package cn.zcf._04sync2;

import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;

import java.nio.charset.StandardCharsets;

public class Producer4 {
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("sync2-producer-group");
        producer.setNamesrvAddr("localhost:9876");
        producer.start();
        Message message = new Message("sync2_topic", "hello_tags","少时诵诗书".getBytes(StandardCharsets.UTF_8));
        SendResult result = producer.send(message);
        System.out.println(result);
        producer.shutdown();
    }
}
